import type { VbenFormSchema } from '#/adapter/form';
import { z } from '#/adapter/form';

// 编辑弹窗表单配置
export const formSchema: VbenFormSchema[] = [
  {
    component: 'ImageUpload',
    fieldName: 'img',
    help: '图片建议尺寸120*120',
    label: '小程序码',
    rules: z.string().min(1, { message: '图片建议尺寸120*120' }),
  },
  {
    component: 'Input',
    componentProps: {
      placeholder: '请输入小程序分享标题',
      allowClear: true,
      class: 'w-2/5',
    },
    fieldName: 'shareText',
    label: '小程序分享标题',
    rules: 'required',
  },
  {
    component: 'ImageUpload',
    fieldName: 'shareImg',
    help: '图片建议长宽比 5:4',
    label: '小程序分享标封面',
    rules: z.string().min(1, { message: '图片建议长宽比 5:4' }),
  },
  {
    component: 'Input',
    componentProps: {
      placeholder: '请输入网站地址',
      allowClear: true,
      class: 'w-2/5',
    },
    fieldName: 'url',
    label: '网站地址',
    rules: 'required',
  },
  {
    component: 'InputNumber',
    componentProps: {
      placeholder: '请输入可借数量',
      allowClear: true,
      class: 'w-2/5',
    },
    fieldName: 'borrowNum',
    label: '可借数量',
    rules: 'required',
  },
  {
    component: 'Input',
    componentProps: {
      placeholder: '请输入客服电话',
      allowClear: true,
      class: 'w-2/5',
    },
    fieldName: 'tel',
    label: '客服电话',
    rules: 'required',
  },
  {
    component: 'Input',
    componentProps: {
      placeholder: '请输入邮箱',
      allowClear: true,
      class: 'w-2/5',
    },
    fieldName: 'email',
    label: '邮箱',
    rules: 'required',
  },
  {
    component: 'Textarea',
    componentProps: {
      placeholder: '请输入地址',
      allowClear: true,
      autosize: {
        minRows: 2,
      },
    },
    fieldName: 'address',
    label: '地址',
    rules: 'required',
  },
  {
    component: 'Textarea',
    componentProps: {
      placeholder: '请输入业务方向',
      allowClear: true,
      autosize: {
        minRows: 4,
      },
    },
    dependencies: {
      show() {
        return false;
      },
      triggerFields: [''],
    },
    fieldName: 'content',
    label: '业务方向',
    rules: 'required',
  },
  {
    component: 'Textarea',
    componentProps: {
      placeholder: '请输入公司简介',
      allowClear: true,
      autosize: {
        minRows: 4,
      },
    },
    fieldName: 'introduction',
    label: '公司简介',
    rules: 'required',
  },
];
